1. Field of the Invention
The present invention relates to an azimuth calculation program that performs an azimuth calculation using output of a magnetic sensor, and also to an electronic compass including the azimuth calculation program.
2. Description of the Related Art
An electronic compass is a device that calculates an azimuth angle from a reference direction using output of a magnetic sensor. In recent years, mobile terminals, such as mobile phones, including such an electronic compass have been developed. Japanese Unexamined Patent Application Publication No. 2004-309228 discloses a method with which an azimuth calculation can be performed in such a mobile terminal, regardless of the place of measurement. In the method disclosed in Japanese Unexamined Patent Application Publication No. 2004-309228, an output value of a magnetic sensor is obtained repeatedly a predetermined number of times or more, so that a circle where the resulting plurality of output values are located is used to perform an azimuth calculation.
However, in the method disclosed in Japanese Unexamined Patent Application Publication No. 2004-309228, since an output value of the magnetic sensor is obtained repeatedly a predetermined number of times or more, a long time is required for the azimuth calculation. Moreover, when an inclination direction of the mobile terminal changes, for example, when the azimuth of the mobile terminal changes while the inclination direction thereof changes, the azimuth calculation cannot be accurately performed with the method described above.